import { request } from "../utils";

// 获取频道列表
export function getChannelAPI(loginForm) {
    return request({
        url: "/v1_0/channels",
        method: "GET",
    })
}

// 提交文章表单
export function createArticleAPI(data) {
    return request({
        url: "/v1_0/mp/articles?draft=false",
        method: "POST",
        data
    })
}

// 获取文章列表
export function getArticleListAPI(params) {
    return request({
        url: "/v1_0/mp/articles",
        method: "GET",
        params
    })
}

// 删除文章
export function delArticleAPI(id) {
    return request({
        url: `/v1_0/mp/articles/${id}`,
        method: "DELETE",
    })
}

// 获取文章详情
export function getArticleDetailAPI(id) {
    return request({
        url: `/v1_0/mp/articles/${id}`,
        method: "GET",
    })
}   

// 更新文章
export function updateArticleAPI(data) {
    return request({
        url: `/v1_0/mp/articles/${data.id}?draft=false`,
        method: "PUT",
        data
    })
}